package report.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import report.dao.repository.*;
import report.dao.vo.report.ReportVO;
import report.service.report.IReportService;
import report.service.tree.ITreeService;
import report.dao.util.ReturnMsgUtil;
import report.dao.vo.tree.TreeVO;

import java.util.List;

/**
 * @Date: Created in 28/12/2017 5:19 PM
 * @Author: pengganyu
 * @Desc:
 */

@Controller
public class SysDictController {
    @Autowired
    private ReportRepository reportRepository;
    @Autowired
    private SysDictRepository sysDictRepository;
    @Autowired
    private SysDictTypeRepository sysDictTypeRepository;
    @Autowired
    private SourceboardRepository sourceboardRepository;


    @Autowired
    private IReportService reportService;




    // 获取report数据源
    @RequestMapping(value = "/report/datasource")
    @ResponseBody
    public ReturnMsgUtil queryDataSource() {
        ReturnMsgUtil res = new ReturnMsgUtil();
        res.setContent( sourceboardRepository.findAll() );
        res.setStatus("success");
        return res;
    }




    // 以下都是测试
    @RequestMapping(value = "/sys/all")
    @ResponseBody
    public List queryAllSys() {
        return sysDictRepository.findAll();
    }

    @RequestMapping(value = "/dict/all")
    @ResponseBody
    public List queryAllType() {
        return sysDictTypeRepository.findAll();
    }

    @RequestMapping(value = "/dict/{id}")
    @ResponseBody
    public List queryNamesById(@PathVariable String id) {
        return sysDictTypeRepository.findNamesById(id);
    }


//    @RequestMapping(value = "/dashboard")
//    @ResponseBody
//    public List queryDashboard() {
//        return dashboardRepository.getAllData();
//    }

}